#!/usr/bin/env python
#-*- coding:utf8 -*-
import os
import sys
import socket
import web
from app.helpers.application_helper import Helper
class Helper(Helper):
    @classmethod
    def is_domain(cls,val):
        if Helper.validation(r"^([0-9a-z]{0,15}\.|)+([0-9a-z_-]{0,15}\.)+(com|cn|cc|info|in|org|net)$",val):
            return True,'域名格式正确.'
        return False,'域名格式不正确.'

    @classmethod
    def get_host(cls,val):
        try:
            return socket.gethostbyname(val) +':80'
        except:
            return '127.0.0.1:80'

